package com.example.dragandview.seniorUI;

import android.app.Activity;
import android.os.Bundle;
import android.widget.ImageView;
import android.widget.SeekBar;


import com.example.dragandview.R;

public class SeekBarActivity extends Activity {
    private ImageView imageView;
    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.serionui_seekbar);
        SeekBar seekBar = findViewById(R.id.id_seekbar);
        imageView = findViewById(R.id.img_seekbar);
        imageView.setAlpha(seekBar.getProgress());
        seekBar.setOnSeekBarChangeListener(new SeekBar.OnSeekBarChangeListener() {
            @Override
            public void onProgressChanged(SeekBar seekBar, int progress, boolean fromUser) {
                System.out.println("触摸进行中===="+progress);
                imageView.setAlpha(progress);
            }

            @Override
            public void onStartTrackingTouch(SeekBar seekBar) {
                System.out.println("开始触摸");
            }

            @Override
            public void onStopTrackingTouch(SeekBar seekBar) {
                System.out.println("触摸结束");
            }
        });
    }
}
